package unittest;

/**
 * 汉明距离
 */
public class HammingDistance {
    public int computeDistance(int x, int y) {
        int s = x ^ y, ret = 0;
        while (s != 0) {
            ret += s & 1;
            s >>= 1;
        }
        return ret;
    }
}
